Skip to content

Birmingham | 2026-MAR-SDC | Joy Opachavalit | Sprint 1 | Can't log in from profile page#198

Open
enjoy15 wants to merge 1 commit into
CodeYourFuture:mainfrom
enjoy15:bug-cant-log-in
Open

Birmingham | 2026-MAR-SDC | Joy Opachavalit | Sprint 1 | Can't log in from profile page#198
enjoy15 wants to merge 1 commit into
CodeYourFuture:mainfrom
enjoy15:bug-cant-log-in

Conversation

@enjoy15

@enjoy15 enjoy15 commented Jun 6, 2026

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Fix: Correct login form handler binding in profile and hashtag views

Problem

Users encountered a 501 error when logging in from the profile or hashtag
pages after logging out. The issue occurred because the login form handler
was incorrectly bound to a link click event instead of the form submit event.

Root Cause

  • profile.mjs and hashtag.mjs used "[data-action='login']" selector (wrong element)
  • Event listener was set to "click" instead of "submit"
  • This meant the form submission wasn't intercepted by the Single‑Page Application handler
  • The browser attempted a default POST to the current page URL
  • Backend has no handler for POST /profile/ or POST /hashtag/
  • Result: 501 error

Solution

  • Updated both files to use "[data-form='login']" selector (correct element)
  • Changed event from "click" to "submit"
  • Now matches the working implementation in bloom.mjs and home.mjs
  • Form submission is now properly intercepted and handled client-side

Files Changed

  • front-end/views/profile.mjs
  • front-end/views/hashtag.mjs

Testing

Users can now:

  1. Log in as sample/sosecret
  2. Click on a username to view their profile
  3. Click logout
  4. Log in again as sample/sosecret
  5. See the logged-in profile view (no 501 error)

@enjoy15 enjoy15 added 📅 Sprint 1 Assigned during Sprint 1 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Legacy-Code The name of the module. labels Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Legacy-Code The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant